import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;

public class Test5 {
    public static void main(String[] args) {
        Integer[] arr = {2, 3, 1, 4, 5, 6};
        Arrays.sort(arr, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return o2 - o1;
            }
        });
        System.out.println(Arrays.toString(arr));

        Arrays.sort(arr, Test5::sub);
    }

    public static int sub(int a, int b) {
        return b - a;
    }
}
